#pragma once

#include <map>

#include "../inner_pre.h"
#include "../event_loop.h"
#include "../slice.h"

struct evhttp_request;
namespace evnetplus {
namespace httpc {
class Request;
class Response {
public:
    typedef std::map<evnetplus::Slice, evnetplus::Slice> Headers;
    Response(Request* r, struct evhttp_request* evreq);
    ~Response();

    int http_code() const {
        return http_code_;
    }
    const evnetplus::Slice& body() const {
        return body_;
    }
    const Request* request() const {
        return request_;
    }
    const char* FindHeader(const char* key);
private:
    Request* request_;
    struct evhttp_request* evreq_;
    int http_code_;
    evnetplus::Slice body_;
};
}
}